package com.magicsoft.share.adapter.my;

import android.support.annotation.LayoutRes;
import android.webkit.WebView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.magicsoft.share.R;
import com.magicsoft.share.bean.my.MessageList;

/**
 * Created by lyf on 2017/11/8/008.
 */

public class NoticeAdapter extends BaseQuickAdapter<MessageList.ListBean, BaseViewHolder> {

    public NoticeAdapter(@LayoutRes int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, MessageList.ListBean item) {

        WebView webView=helper.getView(R.id.webview);
        StringBuilder sb = new StringBuilder();
        // 拼接一段HTML代码
        sb.append("<html>");
        sb.append("<head>");
        sb.append("</head>");
        sb.append("<body>");
        sb.append(item.getContent());
        sb.append("</body>");
        sb.append("</html>");
        webView.loadDataWithBaseURL(null, sb.toString(), "text/html", "utf-8", null);

    }
}
